from threading import Thread, currentThread, activeCount, enumerate
import time


def func():
    # 当前线程对象
    time.sleep(2)
    t = currentThread()
    print(f'线程[{t.name}]运行了')


if __name__ == '__main__':
    for i in range(10):
        t = Thread(target=func, name=f"{i}号")
        t.start()
    print(activeCount(), enumerate())
    # enumerate() 列表，等于 [所有子线程对象,主线程对象]
    # activeCount() = len(enumerate())
